home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / BigLaser.as next >
Encoding:
Text File  |  2011-10-17  |  2.1 KB  |  90 lines

  1. class classes.bro.BigLaser
  2. {
  3.    var x;
  4.    var y;
  5.    var id;
  6.    var dir;
  7.    var clip;
  8.    var axis;
  9.    var w;
  10.    var h;
  11.    var exploX;
  12.    var exploY;
  13.    var xMov = 0;
  14.    var yMov = 0;
  15.    var power = 25;
  16.    function BigLaser(px, py, pDir, pid)
  17.    {
  18.       this.x = px;
  19.       this.y = py;
  20.       this.id = pid;
  21.       this.dir = pDir;
  22.       _root.d = _root.d + 1;
  23.       this.clip = _root.attachMovie("bigLaser","bigLaser" + this.id + "Clip",_root.d + 5000);
  24.       this.clip._x = this.x;
  25.       this.clip._y = this.y;
  26.       this.clip.id = this.id;
  27.       if(this.dir == "U")
  28.       {
  29.          this.axis = "y";
  30.          this.yMov = -40;
  31.          this.xMov = 0;
  32.          this.y += 40;
  33.       }
  34.       else if(this.dir == "D")
  35.       {
  36.          this.axis = "y";
  37.          this.yMov = 40;
  38.          this.xMov = 0;
  39.          this.y -= 40;
  40.       }
  41.       else if(this.dir == "R")
  42.       {
  43.          this.axis = "x";
  44.          this.yMov = 0;
  45.          this.xMov = 40;
  46.          this.x -= 40;
  47.       }
  48.       else
  49.       {
  50.          this.axis = "x";
  51.          this.yMov = 0;
  52.          this.xMov = -40;
  53.          this.x += 40;
  54.       }
  55.       this.clip.gotoAndStop(this.dir);
  56.       this.w = this.clip._width;
  57.       this.h = this.clip._height;
  58.       _root.stats.fired = _root.stats.fired + 1;
  59.    }
  60.    function hit(pnum)
  61.    {
  62.       var _loc4_ = pnum;
  63.       _root.createGunExplo([this.exploX,this.exploY,_root.randRange2(50,80)]);
  64.       this.power -= _loc4_;
  65.       var _loc3_ = 20 - this.power;
  66.       if(_loc3_ < 1)
  67.       {
  68.          _loc3_ = 1;
  69.       }
  70.       this.clip.body.clip.gotoAndStop(_loc3_);
  71.       if(this.power < 1)
  72.       {
  73.          _root.stats.hit = _root.stats.hit + 1;
  74.          _root.removeBroShot("bigLaser" + this.id);
  75.       }
  76.    }
  77.    function main()
  78.    {
  79.       this[this.axis + "Mov"] *= 1.03;
  80.       if(this.x > 1075 || this.x < -75 || this.y > 675 || this.y < -75)
  81.       {
  82.          _root.removeBroShot("bigLaser" + this.id);
  83.       }
  84.       this.x += this.xMov;
  85.       this.y += this.yMov;
  86.       this.clip._x = this.x;
  87.       this.clip._y = this.y;
  88.    }
  89. }
  90.